module.exports = (app) => {
  const { INTEGER, STRING, TEXT, BOOLEAN, DATE } = app.Sequelize
  const WorkComment = app.model.define('works_comment', {
    id: {
      type: INTEGER(20).UNSIGNED,
      primaryKey: true,
      autoIncrement: true,
      allowNull: false,
      comment: '主键id'
    },
    works_id: {
      type: INTEGER(20).UNSIGNED,
      allowNull: false,
      comment: '留言的标签id'
    },
    content: {
      type: TEXT,
      allowNull: false,
      comment: '留言内容'
    },
    username: {
      type: STRING(50),
      allowNull: false,
      comment: '留言用户名'
    },
    avatar_type: {
      type: INTEGER,
      allowNull: false,
      comment: '留言用户头像类型'
    },
    status: {
      type: BOOLEAN,
      allowNull: false,
      defaultValue: 1,
      comment: '状态 1:正常 0:删除'
    },
    created_at: {
      type: DATE,
      get() {
        return new Date(this.getDataValue('created_at')).getTime()
      }
    },
    updated_at: DATE
  })
  return WorkComment
}
